<?php

class RouteStep extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'route_step':
	 * @var string $route_mnemonic
	 * @var string $step_mnemonic
	 * @var integer $index
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'route_step';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('orderIndex', 'required'),
			array('orderIndex', 'numerical', 'integerOnly'=>true),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'step' => array(self::BELONGS_TO, 'Step', 'step_id'),
			'route' => array(self::BELONGS_TO, 'Route', 'route_mnemonic'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'route_id' => 'Route Id',
			'step_mnemonic' => 'Step Mnemonic',
			'orderIndex' => 'Index',
		);
	}
}